package com.zy.config.controller;


import com.zy.config.dto.AppConfigDetailsDto;
import com.zy.config.entity.AppConfigDetails;
import com.zy.config.feign.PropertyFeign;
import com.zy.config.service.RemoteConfigProvider;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;
import java.util.Properties;

@RestController
@Slf4j
public class PropertyFeignController implements PropertyFeign {
    @Autowired
    private RemoteConfigProvider provider;

    @Override
    public Properties property(String appId) {
        return provider.load(appId);
    }

    @Override
    public String propertyToString(String appId) {
        return provider.getStringProperties(appId);
    }

    @Override
    public List<AppConfigDetailsDto> propertyToList(String appId) {
        return provider.getListProperties(appId);
    }
}
